package com.cate.controller.user;

import com.cate.pojo.entity.Category;
import com.cate.result.RestResponse;
import com.cate.service.CategoryService;
import com.cate.utils.ResultUtil;
import io.swagger.annotations.Api;
import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.RestController;

import java.util.List;

/**
 * @CreateTime: 2023/8/1
 * @Author: <==lhd==>
 * @Description:
 */
@RestController("UserCategoryController")
@Slf4j
@RequestMapping("/user/category")
@Api(tags = "用户端分类接口")
public class CategoryController {

    @Autowired
    private CategoryService categoryService;

    @GetMapping("/list")
    public RestResponse getListByType(Integer type){
        final List<Category> categoryList = categoryService.listByType(type);
        return ResultUtil.success(categoryList);
    }
}
